<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateKfFsDepartments extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('fs_departments', function (Blueprint $table) {
            $table->id();

            $table->string("departmentId", 64)->comment("本部门的自定义部门ID")->default("");
            $table->string("openDepartmentId", 64)->comment("部门的open_id")->default("");
            $table->string("parentDepartmentId", 64)->comment("部门的open_id")->default("");
            $table->string("leaderUserId", 64)->comment("部门主管用户ID")->default("");
            $table->string("chat_id", 64)->comment("部门群ID")->default("");
            $table->string("memberCount", 64)->comment("部门下用户的个数")->default("");
            $table->string("name", 64)->comment("部门名称")->default("");
            $table->string("order", 64)->comment("部门的排序，即部门在其同级部门的展示顺序")->default("");

            $table->unsignedInteger("isDeleted")->comment("是否删除")->default(0);

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '飞书 - 部门';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('fs_departments');
    }
}
